﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using _1242026_1242133.DTO;
namespace _1242026_1242133.DAO
{
    class LoaiPhongDAO
    {
        public DataTable ThemLoaiPhong(LoaiPhongDTO LoaiPhongDto)
        {
            SqlSever SQL = new SqlSever();
            SqlParameter[] arrParam = {   new SqlParameter("@MaLoaiPhong", SqlDbType.VarChar), 
                                          new SqlParameter("@TenLoaiPhong", SqlDbType.VarChar),
                                          new SqlParameter("@GiaLoaiPhong", SqlDbType.Int),           
                                          new SqlParameter("@SoKhachToiDa", SqlDbType.Int),
                                          new SqlParameter("@TyLePhuThu", SqlDbType.Float),
                                      };
            arrParam[0].Value = LoaiPhongDto.MaLoaiPhong;
            arrParam[1].Value = LoaiPhongDto.TenLoaiPhong;
            arrParam[2].Value = LoaiPhongDto.GiaLoaiPhong;
            arrParam[3].Value = LoaiPhongDto.SoKhachToiDa;
            arrParam[4].Value = LoaiPhongDto.TyLePhuThu;
            DataTable data = SQL.ExecuteStore("sp_ThemLoaiPhong", arrParam);
            return data;
        }
        public DataTable LoadDanhSachLoaiPhong()
        {
            SqlSever SQL = new SqlSever();
            return SQL.ExecuteCommandText("Select * From LoaiPhong");
        }
        public DataTable LoadGiaTheoLoaiPhong(string MaLoaiPhong)
        {
            SqlSever sql = new SqlSever();
            SqlParameter[] arrParam = { new SqlParameter("@MaLoaiPhong", SqlDbType.VarChar) };
            arrParam[0].Value = MaLoaiPhong;
            return sql.ExecuteStore("sp_LoadGiaTheoLoaiPhong",arrParam);
        }
    }
}
